<template>
	<view class="msg-page" :key="refreshKey">
		<view class="no-data animate__bounceIn" v-show="noDataFlag" style="animation-duration: 2s;">
			<uv-empty mode="message" text="暂无最新消息" iconColor="#d0021b" textColor="black" marginTop="32"></uv-empty>
		</view>
		<view class="notices animate__bounceIn" style="animation-duration: 2s;">
			<view class="notice" v-for="record in records">
				<view class="publish-time">{{record.formatCreateTime}}</view>
				<view class="notice-title-content">
					<view class="notice-title">
						<view class="notice-title-inner">{{record.content}}</view>
					</view>
					<uv-line></uv-line>
					<view class="notice-detail">
						<view class="notice-detail-l">{{record.typeName}}</view>
						<view class="notice-detail-r">
							<!-- <view class="unread-flag"></view> -->
							<uv-icon name="arrow-right" size="12">
							</uv-icon>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				noDataFlag: false,
				records: [],
				refreshKey:0
			}
		},
		onLoad() {
			this.allMarkSeen();
			this.findMyPersonalMsg();
		},
		onShow(){
			this.refreshKey += 1;
		},
		methods: {
			
			allMarkSeen() {
				var that = this;
				uni.$uv.http.post('/personalMsg/allMarkSeen', {}).then(res => {
				});
			},
			
			findMyPersonalMsg() {
				var that = this;
				uni.$uv.http.get('/personalMsg/findMyPersonalMsg').then(res => {
					that.records = res.data;
					that.noDataFlag = that.records.length == 0;
				});
			},
		}
	}
</script>

<style>
page {
	background-color: #f9f9f9;
}
	.unread-flag {
		height: 12rpx;
		width: 12rpx;
		background: #d14f4e;
		border-radius: 100%;
		margin-right: 12rpx;
	}

	.notice-detail {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-left: 32rpx;
		padding-right: 32rpx;
		padding-top: 14rpx;
		padding-bottom: 14rpx;
	}

	.notice-detail-l {
		color: #769ac3;
		font-size: 24rpx;
	}

	.notice-detail-r {
		display: flex;
		align-items: center;
	}

	.publish-time {
		text-align: center;
		line-height: 4.5;
		color: #888;
		font-size: 24rpx;
	}

	.notice-title {
		padding-left: 32rpx;
		padding-bottom: 28rpx;
		padding-right: 32rpx;
		text-indent: 8rpx;
	}

	.notice-title-inner {
		overflow: hidden;
		max-height: 80rpx;
		min-height: 40rpx;
		line-height: 40rpx;
		color: black;
	}

	.notice-title-content {
		background: white;
		padding-top: 28rpx;
		border-radius: 20rpx;
	}

	.notice {}

	.notices {
		padding-left: 32rpx;
		padding-right: 32rpx;
	}

	.msg-page {
		height: 100%;
	}
</style>